/*******************************************************************************
 * Copyright (c) 2010, 2010 Xbeam Project and ChenZhiKong.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 *******************************************************************************/
package org.bellusoft.xbeam.framework;


import org.bellusoft.xbeam.framework.XbeamConstants.AutoStartSetting;


/**
 *<bundle url="file:/path/to/bundlea.jar"  startSetting="accordingPolicy" updateCache="false"  startLevel="2" overidePersist="true"/>
 */
public class InitialBundle {
	
	private final int startLevel ; 
	
	private final AutoStartSetting startSetting ; 
	
	private final String bundleUrl ; 
	
	private final boolean updateCache ; 
	
	private final boolean overidePersist ; 
	
	
	/**
	 * @param startLevel bundle initial start level ;  
	 * @param startSetting bundle initial start setting; 
	 * @param bundleUrl: bundle install URL ; 
	 * @param updateCache: should 
	 * @param overidePersist
	 * 
	 * @see AutoStartSetting
	 */
	public InitialBundle(int startLevel, AutoStartSetting startSetting,
			String bundleUrl, boolean updateCache, boolean overidePersist) {
		this.startLevel = startLevel;
		this.startSetting = startSetting;
		this.bundleUrl = bundleUrl;
		this.updateCache = updateCache;
		this.overidePersist = overidePersist;
	}

	/**
	 * @param bundleUrl Bundle install URL ;
	 */
	public InitialBundle(String bundleUrl) {
		this.bundleUrl = bundleUrl ; 
		this.startLevel = 1 ; 
		this.startSetting = AutoStartSetting.declared; 
		this.updateCache = false ; 
		this.overidePersist = false ; 
	}

	/**
	 * @return the startLevel
	 */
	public int getStartLevel() {
		return startLevel;
	}

	/**
	 * @return the startSetting
	 */
	public AutoStartSetting getStartSetting() {
		return startSetting;
	}

	/**
	 * @return the bundleUrl
	 */
	public String getBundleUrl() {
		return bundleUrl;
	}

	/**
	 * @return the updateCache
	 */
	public boolean isUpdateCache() {
		return updateCache;
	}

	/**
	 * @return the overidePersist
	 */
	public boolean isOveridePersist() {
		return overidePersist;
	}
	
	public static InitialBundle parse(String value){
		//TODO: to implement the method
		throw new UnsupportedOperationException("TODO") ; 
	}

}
